import { http } from "../utils/request"

export interface taskParams {
  endTime:string
  page:number
  pageSize:number
  startTime:string
  status:number
  transportTaskId:string

}
export  interface  taskItem{

  id:string,
  startAgencyId: string,
  startAddress: string
  endAgencyId:string
  endAddress: string
  status: number,
  driverId:string
  transportTaskId: string
  startHandover: string,
  finishHandover: string,
  planDepartureTime: string
  actualDepartureTime: string,
  planArrivalTime: string
  actualArrivalTime: string,
  created: string,
  enablePickUp: boolean

}

export  interface  taskData{
  counts:string,
  pageSize:number,
  pages:number,
  page: number,
  items:taskItem[]

}
export interface taskResult{
  code:number,
  msg:string
  data:taskData
}
export  interface urlList{
  url:string
}
export interface  takeDeliveryParams{
  cargoPickUpPictureList:urlList[],
  id:string,
  cargoPictureList:urlList[]
}
export interface tasksdeliver{
  deliverPictureList:urlList[],
  id:string,
  certificatePictureList:urlList[]
}
export const taskList = (data:taskParams): Promise<taskResult> => {
  return http.get<taskResult>("/tasks/list",data)
}
export const takeDelivery = (data:takeDeliveryParams): Promise<taskResult> => {
  return http.post<taskResult>("/tasks/takeDelivery",data)
}
export const takeDeliver = (data:tasksdeliver): Promise<taskResult> => {
  return http.post<taskResult>("/tasks/deliver",data)
}
